﻿using System;
using System.Web;
using SocialKit.LightRest.OAuth;

namespace LightRestDemoSite
{
    public partial class SinaOAuthCallback : System.Web.UI.Page
    {
        Consumer SinaConsumer
        {
            get { return (Consumer)Application["sina_consumer"]; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            var query = HttpUtility.ParseQueryString(Request.Url.Query);

            var requestToken = (RequestToken)Session["sina_request_token"];

            var accessToken = requestToken.ToAccessToken(query["oauth_verifier"]);

            Session["sina_access_token"] = accessToken;

            Response.Redirect("sinaweibo.aspx");
        }
    }
}